home *** CD-ROM | disk | FTP | other *** search
/ Utilities Professional 1-1500 / Utilities Professional 1-1500 (1994)(WPD)[!].iso / 12511500 / var1432.dms / var1432.adf / NDUK-V40.lha / V40 / include / exec / memory.h < prev    next >
C/C++ Source or Header  |  1993-10-15  |  3KB  |  105 lines

  1. #ifndef    EXEC_MEMORY_H
  2. #define    EXEC_MEMORY_H
  3. /*
  4. **    $VER: memory.h 39.3 (21.5.92)
  5. **    Includes Release 40.15
  6. **
  7. **    Definitions and structures used by the memory allocation system
  8. **
  9. **    (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  10. **        All Rights Reserved
  11. */
  12.  
  13. #ifndef EXEC_NODES_H
  14. #include "exec/nodes.h"
  15. #endif /* EXEC_NODES_H */
  16.  
  17.  
  18. /****** MemChunk ****************************************************/
  19.  
  20. struct    MemChunk {
  21.     struct  MemChunk *mc_Next;    /* pointer to next chunk */
  22.     ULONG   mc_Bytes;        /* chunk byte size    */
  23. };
  24.  
  25.  
  26. /****** MemHeader ***************************************************/
  27.  
  28. struct    MemHeader {
  29.     struct  Node mh_Node;
  30.     UWORD   mh_Attributes;    /* characteristics of this region */
  31.     struct  MemChunk *mh_First; /* first free region        */
  32.     APTR    mh_Lower;        /* lower memory bound        */
  33.     APTR    mh_Upper;        /* upper memory bound+1    */
  34.     ULONG   mh_Free;        /* total number of free bytes    */
  35. };
  36.  
  37.  
  38. /****** MemEntry ****************************************************/
  39.  
  40. struct    MemEntry {
  41. union {
  42.     ULONG   meu_Reqs;        /* the AllocMem requirements */
  43.     APTR    meu_Addr;        /* the address of this memory region */
  44.     } me_Un;
  45.     ULONG   me_Length;        /* the length of this memory region */
  46. };
  47.  
  48. #define me_un        me_Un    /* compatibility - do not use*/
  49. #define me_Reqs     me_Un.meu_Reqs
  50. #define me_Addr     me_Un.meu_Addr
  51.  
  52.  
  53. /****** MemList *****************************************************/
  54.  
  55. /* Note: sizeof(struct MemList) includes the size of the first MemEntry! */
  56. struct    MemList {
  57.     struct  Node ml_Node;
  58.     UWORD   ml_NumEntries;    /* number of entries in this struct */
  59.     struct  MemEntry ml_ME[1];    /* the first entry    */
  60. };
  61.  
  62. #define ml_me    ml_ME        /* compatability - do not use */
  63.  
  64.  
  65. /*----- Memory Requirement Types ---------------------------*/
  66. /*----- See the AllocMem() documentation for details--------*/
  67.  
  68. #define MEMF_ANY    (0L)    /* Any type of memory will do */
  69. #define MEMF_PUBLIC (1L<<0)
  70. #define MEMF_CHIP   (1L<<1)
  71. #define MEMF_FAST   (1L<<2)
  72. #define MEMF_LOCAL  (1L<<8)    /* Memory that does not go away at RESET */
  73. #define MEMF_24BITDMA (1L<<9)    /* DMAable memory within 24 bits of address */
  74. #define    MEMF_KICK   (1L<<10)    /* Memory that can be used for KickTags */
  75.  
  76. #define MEMF_CLEAR   (1L<<16)    /* AllocMem: NULL out area before return */
  77. #define MEMF_LARGEST (1L<<17)    /* AvailMem: return the largest chunk size */
  78. #define MEMF_REVERSE (1L<<18)    /* AllocMem: allocate from the top down */
  79. #define MEMF_TOTAL   (1L<<19)    /* AvailMem: return total size of memory */
  80.  
  81. #define    MEMF_NO_EXPUNGE    (1L<<31) /*AllocMem: Do not cause expunge on failure */
  82.  
  83. /*----- Current alignment rules for memory blocks (may increase) -----*/
  84. #define MEM_BLOCKSIZE    8L
  85. #define MEM_BLOCKMASK    (MEM_BLOCKSIZE-1)
  86.  
  87.  
  88. /****** MemHandlerData **********************************************/
  89. /* Note:  This structure is *READ ONLY* and only EXEC can create it!*/
  90. struct MemHandlerData
  91. {
  92.     ULONG    memh_RequestSize;    /* Requested allocation size */
  93.     ULONG    memh_RequestFlags;    /* Requested allocation flags */
  94.     ULONG    memh_Flags;        /* Flags (see below) */
  95. };
  96.  
  97. #define    MEMHF_RECYCLE    (1L<<0)    /* 0==First time, 1==recycle */
  98.  
  99. /****** Low Memory handler return values ***************************/
  100. #define    MEM_DID_NOTHING    (0)    /* Nothing we could do... */
  101. #define    MEM_ALL_DONE    (-1)    /* We did all we could do */
  102. #define    MEM_TRY_AGAIN    (1)    /* We did some, try the allocation again */
  103.  
  104. #endif    /* EXEC_MEMORY_H */
  105.